UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dbJjdo/AYfKoPchsmhHDJFEk27HvWoCnuM8jzfv8U+Y=' 
WHERE 
  key_id = '6283790d21e4292ac80133e5d7b90ab9d52d81fe64a43cf74ae1ff9a55a9813f' 
  AND (
    token = 'dbJjdo/AYfKoPchsmhHDJFEk27HvWoCnuM8jzfv8U+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038