UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CWqFr5p0FZQnvTd9hcHIW5vpToPX5vUvRhT1ylCfXFg=' 
WHERE 
  key_id = '17d6761bfd064aecb14b280235f55bb3cc2286ecafc9cc58ac33d21feec861ec' 
  AND (
    token = 'CWqFr5p0FZQnvTd9hcHIW5vpToPX5vUvRhT1ylCfXFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025