UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z9ubXoLrHEXgQhAD8QVo2wXZB2i2NL8uxSNSrSS2dRM=' 
WHERE 
  key_id = 'abfe357809cd48e7b797385f567650ddd4a7349fd1ea40a154a03fe33ef02763' 
  AND (
    token = 'z9ubXoLrHEXgQhAD8QVo2wXZB2i2NL8uxSNSrSS2dRM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031