UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iRjRuUfaiIWc36CJ+gUUe7n2/OMXxM+fJa783+HXkmQ=' 
WHERE 
  key_id = '1cc09274fab536778ac579fdd9977ab64808118fa4217049d414f66aefc103a5' 
  AND (
    token = 'iRjRuUfaiIWc36CJ+gUUe7n2/OMXxM+fJa783+HXkmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034