UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0LzOEkix5j/99G+jQhlRSIjQNJ4w+Bbe6Y4PkQDKzWU=' 
WHERE 
  key_id = '58deee7981b67c29f96ee1464bd80c4e47afb824e3263b2fae4eea23b8eb76a8' 
  AND (
    token = '0LzOEkix5j/99G+jQhlRSIjQNJ4w+Bbe6Y4PkQDKzWU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032