UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bdjXFO/Q0bT/c2RVP3XXRe59OgH8BsRfJ36hJu+OTj4=' 
WHERE 
  key_id = 'cb8a8902529705856f0332d146974e4784a2f4e3586c14e0f11c845ab8f2293d' 
  AND (
    token = 'bdjXFO/Q0bT/c2RVP3XXRe59OgH8BsRfJ36hJu+OTj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031