UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5l+VnUvTlN/vdo8iAGyAFkWMSGIvQay2OPbgrq/YdXA=' 
WHERE 
  key_id = '893e738710dc0d3a104bce06396af1743b788b8ab151f32dde852550e55fd6a1' 
  AND (
    token = '5l+VnUvTlN/vdo8iAGyAFkWMSGIvQay2OPbgrq/YdXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059