UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C+QPwW9rs9aQz1QEGM1BR70cLgR80HeG4Ttl2JZxDt8=' 
WHERE 
  key_id = 'e09cdf6c9621feadc149b7aa1c918654bc10aca34fe0988f5f55408d0d7b6c78' 
  AND (
    token = 'C+QPwW9rs9aQz1QEGM1BR70cLgR80HeG4Ttl2JZxDt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029