UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JY0BgNbPc0CnycbIdvjdwkNZogCU+DV1mauiKNCzGfU=' 
WHERE 
  key_id = 'bede48ad90e53883d3aec48863392ddd3a2c9308d80ad2e36e564970d51e2d6e' 
  AND (
    token = 'JY0BgNbPc0CnycbIdvjdwkNZogCU+DV1mauiKNCzGfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014