UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fIIAPIr3HMn93/AIVeDe6WKiHdO0kQ5qubgu9iBJ6hk=' 
WHERE 
  key_id = 'd50e4f3a196c40af678d205f0aa64ab4f9177e132c84a64984d9ff24f0356015' 
  AND (
    token = 'fIIAPIr3HMn93/AIVeDe6WKiHdO0kQ5qubgu9iBJ6hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026