UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8fTZeQc2GrS0sySUiPwHUXBCFytUyIcMmigOARPBCRc=' 
WHERE 
  key_id = '7beda3dec0fb3024f67828f52463553c9df54a1d5e97e1e5ac07fdc0c5e9283c' 
  AND (
    token = '8fTZeQc2GrS0sySUiPwHUXBCFytUyIcMmigOARPBCRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018