UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O5CwcZlG6pSBKJHD7w/UMsq4p2DhcGbrxhCL1Yk7SgU=' 
WHERE 
  key_id = '1b04cd2aee3dcbad70707499cb2a3e8594787e7da0a6bfc7a52994145e54c3e4' 
  AND (
    token = 'O5CwcZlG6pSBKJHD7w/UMsq4p2DhcGbrxhCL1Yk7SgU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027