UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a/G9QO+VoglkVjivQHOfMY05AH3/7hIzBqX19lieeCM=' 
WHERE 
  key_id = '6e887271d0cd84cb09b0b46578e232d07c467aa715d52cb2ee1969da53e64f50' 
  AND (
    token = 'a/G9QO+VoglkVjivQHOfMY05AH3/7hIzBqX19lieeCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019