UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KJNGJXc9Cz9iBu8dDWQGu50K6PAWk3dpizoaJK/87jU=' 
WHERE 
  key_id = '46f7dbe2dbb54891fe9dde53f7904d64c57a612b66536f61727ba768556329cc' 
  AND (
    token = 'KJNGJXc9Cz9iBu8dDWQGu50K6PAWk3dpizoaJK/87jU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022