UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EbHVaN8ooEJoVzrQ4xvxF4tCNuLi+RsIDc+5/aeaBY8=' 
WHERE 
  key_id = '07219d35925973225388b2638fe19d344bb466b56b159acd0b1d5016f6af5ad8' 
  AND (
    token = 'EbHVaN8ooEJoVzrQ4xvxF4tCNuLi+RsIDc+5/aeaBY8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041