UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0w1leoRwFPlMMkvwZt4cQu5H95qyfChr8cYX1l4xLrM=' 
WHERE 
  key_id = 'caa027b5dd766cbf92d81f3bb668cf09cfb75998e4efe5997acdfa389203761a' 
  AND (
    token = '0w1leoRwFPlMMkvwZt4cQu5H95qyfChr8cYX1l4xLrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023