UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OGg8sqZHZFERvj4hqCHt9c9/CKsWT+Qb6D5CF+dRFKE=' 
WHERE 
  key_id = '4737d602a8f157accb5efc573d020499dc1e1070d01946f67f14b06825c70b18' 
  AND (
    token = 'OGg8sqZHZFERvj4hqCHt9c9/CKsWT+Qb6D5CF+dRFKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025