UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WhSOoH0F0PtBOe62z9u5ySVdKFtIOnrkKirQD3g7Bps=' 
WHERE 
  key_id = '14848bec655ca5a2b8a48e7f334b0d16b878bbc478b65eed77339416719a9d51' 
  AND (
    token = 'WhSOoH0F0PtBOe62z9u5ySVdKFtIOnrkKirQD3g7Bps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022