UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nMkQMS4VAYTtcqDPVgULweeo2P+NDTvBp8GUPPAaCAc=' 
WHERE 
  key_id = 'b9c710045ecb9f6d3943dd7ca5183b1baded6f016f5b3fa8de23b800af3218d0' 
  AND (
    token = 'nMkQMS4VAYTtcqDPVgULweeo2P+NDTvBp8GUPPAaCAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036