UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SWimAp0D/44ZN06WhVcq4bWybm01whq0Rnu0F+/vS74=' 
WHERE 
  key_id = '90d7a63a429cf890d7a6cc51fd074d2ebf08eaad8ece0a8bb16ba24b270e0539' 
  AND (
    token = 'SWimAp0D/44ZN06WhVcq4bWybm01whq0Rnu0F+/vS74=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024