UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1DdXKQj2lBu/OWRsjMd5AAxBL63CMBTphq+4U/Gu0qc=' 
WHERE 
  key_id = '9991eb8fd14a3baa3f784b8d356ea965edd382e4f92034d52f534f05c38db0d9' 
  AND (
    token = '1DdXKQj2lBu/OWRsjMd5AAxBL63CMBTphq+4U/Gu0qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040