UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1TO0DStsrmTdB3D12fDZI+kMRZM3G/Wki/7ZuBqJfyE=' 
WHERE 
  key_id = '0c831e5be99f2183e4a2c03397971dc3fb065cffb0e930a6566bd216b4d2af4d' 
  AND (
    token = '1TO0DStsrmTdB3D12fDZI+kMRZM3G/Wki/7ZuBqJfyE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037