UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nTvCILnZItYHCefYEEe4ekW2vmrU2IwovWIea066Tw0=' 
WHERE 
  key_id = 'ab4e72c4fd19489d09fb29bd71af0f1f364dff828662d68c7ec4323426d99313' 
  AND (
    token = 'nTvCILnZItYHCefYEEe4ekW2vmrU2IwovWIea066Tw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037