UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gsukG1HyuGPfnL/jxlPA2TKDYUmhXgs23e666j3L/SU=' 
WHERE 
  key_id = '7a3d4874f3d81e658a1a3b95625b48d5a49f06921bf646fb0d6b3b0fd9ef8d5b' 
  AND (
    token = 'gsukG1HyuGPfnL/jxlPA2TKDYUmhXgs23e666j3L/SU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047