UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BXwPPl5uwAmXNSciO9Rr+jUzNQmh/e4i1muMHjYDdsA=' 
WHERE 
  key_id = '22077d6963e4bc7a7f69a9a458dd03c16e0d5d8f9b3a65c4852937f168a2a97a' 
  AND (
    token = 'BXwPPl5uwAmXNSciO9Rr+jUzNQmh/e4i1muMHjYDdsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00134