UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HWr2Wem/9qMQY0gechNyNZgLA38VITNjjok26L2f+lw=' 
WHERE 
  key_id = 'be880ff07ed3ee6fd1077b396f3a4c9303c0d35ddf9dd21ba0657417963dbb79' 
  AND (
    token = 'HWr2Wem/9qMQY0gechNyNZgLA38VITNjjok26L2f+lw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049