UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X+u1QfBU4kLMOceCsnkkgAmAYzM58USDJy/UQv0QxVE=' 
WHERE 
  key_id = '21cb2f397104b227f81a0ec3471c2430dda213eb9ac966291b840c45a1600b7a' 
  AND (
    token = 'X+u1QfBU4kLMOceCsnkkgAmAYzM58USDJy/UQv0QxVE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029