UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/fsCWjt9aFfqOqs+jND3C3ckLoahlg++PRDzWuDtVuY=' 
WHERE 
  key_id = 'ae61a30d29f631b4ab7b847c78c59a3e6906fca859717ed65487a497b1608a38' 
  AND (
    token = '/fsCWjt9aFfqOqs+jND3C3ckLoahlg++PRDzWuDtVuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036